<div class="page-breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="fa fa-home"></i>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#">系统设置</a>
        </li>
        <li class="active">菜单管理</li>
    </ul>
</div>
<!-- Page Body -->
<div class="page-body">
    <div class="row">
        <div class="col-lg-12 col-sm-12 col-xs-12">
            <div class="widget">
                <div class="widget-header bordered-left bordered-darkorange">
                    <span class="widget-caption">过滤条件</span>
                    <div class="widget-buttons">
                        <a href="#" data-toggle="maximize">
                            <i class="fa fa-expand"></i>
                        </a>
                        <a href="#" data-toggle="collapse">
                            <i class="fa fa-minus"></i>
                        </a>
                        <a href="#" data-toggle="dispose">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="widget-body bordered-left bordered-warning">
                    <div class="form-inline" role="form">
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputEmail2">Email address</label>
                            <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Enter email">
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="exampleInputPassword2">Password</label>
                            <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password">
                        </div>
                        <button type="submit" class="btn btn-default">检索</button>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="widget">
                <div class="widget-header bordered-bottom bordered-yellow">
                    <span class="widget-caption">Search on All Columns</span>
                    <div class="widget-buttons">
                        <a href="#" data-toggle="maximize">
                            <i class="fa fa-expand"></i>
                        </a>
                        <a href="#" data-toggle="collapse">
                            <i class="fa fa-minus"></i>
                        </a>
                        <a href="#" data-toggle="dispose">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="widget-body">
                    <table id="dt_basic" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th data-class="phone,tablet">ID</th>
                            <th data-class="expand">名称</th>
                            <th data-hide="phone">请求地址</th>
                            <th data-hide="phone,tablet">菜单类型</th>
                            <th data-hide="phone">操作</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>

</div>

<script type="application/javascript">



    $(function(){
        var oTable = $('#dt_basic').dataTable({
            serverSide: true, //启用服务器端分页
            //searching: false, //禁用原生搜索
            orderMulti: false,
            "sDom": "Tflt<'row DTTTFooter'<'col-sm-6'i><'col-sm-6'p>>",
            "oTableTools": {
                "aButtons": [
                    "copy", "csv", "xls", "pdf", "print"
                ],
                "sSwfPath": "assets/swf/copy_csv_xls_pdf.swf"
            },
            "language": {
                "search": "",
                "sLengthMenu": "_MENU_",
                "oPaginate": {
                    "sPrevious": "Prev",
                    "sNext": "Next"
                }
            },
            columns: [
                { "data": "id" },
                { "data": "name" },
                { "data": "url" },
                { "data": "menuDef" },
                { "data": "id" ,
                    "render":function(data, type, full, meta){
                        var tmp = '<a href="#" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> Edit</a> <a href="#" class="btn btn-danger btn-xs delete"><i class="fa fa-trash-o"></i> Delete</a>';
                                /*'<a class="btn btn-info btn-xs edit" href="javascript:alert(&quot;'+data+'&quot;)"><i class="fa fa-trash-o"></i> 删除</a>'
                                +'<a class="btn btn-danger btn-xs delete" href="javascript:alert(&quot;'+data+'&quot;)"><i class="fa fa-edit"></i> 修改</a>';*/
                        return tmp;
                    }
                }
            ],
            ajax: function (data, callback, settings) {
                var param = {};
                param.limit = data.length;//页面显示记录条数，在页面显示每页显示多少项的时候
                param.start = data.start;//开始的记录序号
                param.page = (data.start / data.length) + 1;//当前页码
                param.requestUrl=$('#requestUrl').val();

                $.ajax({
                    type: "GET",
                    url: "http://115.28.66.183:8080/ibsm-system/rest/v1/sys/menu/"+param.page+"/"+param.limit,
                    cache: false, //禁用缓存
                    data: param, //传入组装的参数
                    dataType: "json",
                    success: function (content) {
                        var result = content.result;
                        if(null != content.result){
                            var returnData = {};
                            returnData.draw=result.content;//这里直接自行返回了draw计数器,应该由后台返回
                            returnData.recordsTotal = result.totalSize;//返回数据全部记录
                            returnData.recordsFiltered = result.totalSize;//后台不实现过滤功能，每次查询均视作全部结果
                            returnData.data = result.content;//返回的数据列表
                            callback(returnData);
                        }
                    }
                });
            }
        }).api();

    })
</script>